Skip to content

feat: Add aw87xxx codec for AyaNeo/Ayn/Orange Pi handheld speaker amplifiers - #102

Merged
KyleGospo merged 10 commits into
OpenGamingCollective:features/ayaneofrom
hijae:add-aw87xxx-flip-speaker
Sep 1, 2026
Merged

feat: Add aw87xxx codec for AyaNeo/Ayn/Orange Pi handheld speaker amplifiers#102
KyleGospo merged 10 commits into
OpenGamingCollective:features/ayaneofrom
hijae:add-aw87xxx-flip-speaker

Conversation

@hijae

@hijae hijae commented Aug 25, 2026

Copy link
Copy Markdown

Context

Several handhelds (AyaNeo Flip KB/DS, AIR 1S, AIR Plus, Kun; Ayn Loki MiniPro; Orange Pi NEO-01) use the Awinic AW87XXX Smart K PA as their speaker amplifier, identified over ACPI as AWDZ8830. Mainline Linux has no driver for this chip — the closest match (aw87390.c) doesn't recognize it. Without this driver these devices have no speaker output at all.

This driver was lost when Bazzite's kernel source switched to OGC, unrelated to the driver itself. See ublue-os/bazzite#5374 for the resulting regression report (AyaNeo AIR 1S, no audio since the kernel switch).

All commits in this PR are downstream-only carries and are tagged [NOT-FOR-UPSTREAM] accordingly — none of this is intended to be sent to mainline Linux.

Changes

Rebased onto current features/ayaneo (no more unrelated commits pulled in via merge) and reconstructed as individual, properly-attributed commits instead of a squash:

  • 5 commits: the original aw87xxx driver, cherry-picked (-x) from the real upstream source, ChimeraOS/linux (6.14/chimeraos), preserving each original author (Matthew Anderson, CVMagic, Bouke Sybren Haarsma).
  • 1 commit: DMI-based firmware filename selection (multi-device support), an OGC-specific addition on top of the ChimeraOS base — not a cherry-pick, but keeps the original co-authorship (bouhaa, Antheas Kapenekakis).
  • 1 commit: drop a dead linux/of_gpio.h include (header no longer exists in this tree) so it builds on current kernels.
  • 1 commit: add a version-gated compat shim for snd_soc_unregister_component() so the driver still builds on newer (6.16+) kernels.
  • 1 commit: actually request the reset GPIO (devm_gpio_request_one()) in the valid-GPIO branch, which previously fell through without claiming the pin.
  • 1 commit: add an ALC269VB pin fixup for the AIR 1S's internal speaker, cherry-picked (-x) from hhd-dev/patchwork (fewtarius, co-developed by linh1987) — needed in addition to the aw87xxx driver above, since the AIR 1S's main HDA codec pin routing isn't otherwise configured for internal speaker output.

(Correction from the previous PR description: the aw87xxx driver itself comes from ChimeraOS/linux, not hhd-dev/patchwork — only the AIR 1S pin fixup is from hhd-dev/patchwork.)

Testing

Built out-of-tree against this branch's exact source (kernel-devel 7.2.0-ogc4.1) and verified on real AyaNeo Flip KB hardware — chip probes correctly (chip_id 0x5a, product aw87559), and speaker audio works, including after a fresh reboot.

The AIR 1S pin fixup has been directly confirmed by @bl1nk: they built this exact commit against this PR branch and verified both internal speaker output and the module symbol names (ALC269VB_FIXUP_AYANEO_SPKR_PIN_FIX, ayaneo-speaker-pin-fix) match what's in this PR (see comments below).

All modules were also rebuilt out-of-tree here after the rebase (snd-soc-aw87xxx.ko, snd-hda-codec-alc269.ko) to confirm they still compile cleanly and contain the same symbols.

@hijae

hijae commented Aug 25, 2026

Copy link
Copy Markdown
Author

Companion PR enabling this in the build config: OpenGamingCollective/kernel-packages#36CONFIG_SND_SOC_AW87XXX isn't on by default, so without that PR this driver is present but never actually built.

@pastaq

pastaq commented Aug 25, 2026

Copy link
Copy Markdown
Member

Are we planning to upstream this, or rework it before hand? Authorship makes it somewhat of a challenge.
@BoukeHaarsma23 I would love your input here.

KyleGospo pushed a commit to OpenGamingCollective/kernel-packages that referenced this pull request Aug 25, 2026
CONFIG_SND_SOC_AW87XXX is added by OpenGamingCollective/linux#102.
Enable it as a module so it's actually built.

Signed-off-by: Hijae Song <hijae@naver.com>
@bl1nk

bl1nk commented Aug 26, 2026

Copy link
Copy Markdown

For the AYANEO Air 1S another quirk in the ALC269 codec is necessary to fix audio output. I commented on the initial bug report in ublue-os/bazzite: ublue-os/bazzite#5374 (comment)

@hijae Do you want to include a fix for that in this PR as well or should this be done via a separate PR?

Working patch to fix audio output on the AYANEO Air 1S

I went back and forth with an LLM to write this, but I am neither a kernel contributor nor am I experienced in C. I understand the code, but I do not understand why 0x90170110 results in the correct pinout. It seems to be some conventional value that is used in other fixes for the realtek codec across the tree to indicate what an internal speaker is.

This fix is should even be safer than the upstream one as we are only targeting the Air 1S specifically.

diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index cae327e1d9..390bf19966 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -3998,6 +3998,7 @@
 	ALC269VB_FIXUP_ASUS_ZENBOOK,
 	ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
 	ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
+	ALC269_FIXUP_AYANEO_AIR_1S,
 	ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
 	ALC269VB_FIXUP_ORDISSIMO_EVE2,
 	ALC283_FIXUP_CHROME_BOOK,
@@ -4299,6 +4300,19 @@
 	ALC285_LENOVO_DAC_RENAME,
 };
 
+static void alc269_fixup_ayaneo_air_1s(struct hda_codec *codec,
+				       const struct hda_fixup *fix, int action)
+{
+	if (action != HDA_FIXUP_ACT_PRE_PROBE)
+		return;
+
+	if (!dmi_match(DMI_SYS_VENDOR, "AYANEO") ||
+	    !dmi_match(DMI_PRODUCT_NAME, "AIR 1S"))
+		return;
+
+	snd_hda_codec_set_pincfg(codec, 0x1a, 0x90170110);
+}
+
 /* A special fixup for Lenovo C940 and Yoga Duet 7;
  * both have the very same PCI SSID, and we need to apply different fixups
  * depending on the codec ID
@@ -4530,6 +4544,10 @@
 			{ }
 		},
 	},
+	[ALC269_FIXUP_AYANEO_AIR_1S] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc269_fixup_ayaneo_air_1s,
+	},
 	[ALC269_FIXUP_AMIC] = {
 		.type = HDA_FIXUP_PINS,
 		.v.pins = (const struct hda_pintbl[]) {
@@ -8213,6 +8231,7 @@
 	SND_PCI_QUIRK(0x1f4c, 0xb020, "Minisforum AI X1 Pro",
 		      ALC245_FIXUP_MINISFORUM_JACK_DETECT),
 	SND_PCI_QUIRK(0x1f4c, 0xe001, "Minisforum V3 (SE)", ALC245_FIXUP_BASS_HP_DAC),
+	SND_PCI_QUIRK(0x1f66, 0x0103, "AYANEO AIR 1S", ALC269_FIXUP_AYANEO_AIR_1S),
 	SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
 	SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
 	SND_PCI_QUIRK(0x2039, 0x0001, "Inspur S14-G1", ALC295_FIXUP_CHROME_BOOK),

@hijae

hijae commented Aug 26, 2026

Copy link
Copy Markdown
Author

@bl1nk
I can include it if you'd like. However, I don't have an Air 1s device and can't test it, so I recommend that you create a separate PR yourself.
Also, I'm not sure if my PR will be accepted because of the authorship issue.

@pastaq

pastaq commented Aug 26, 2026

Copy link
Copy Markdown
Member

We'll most likely carry this patch as it is needed for many devices. The authorship issue is administrative. I asked bl1nk to see if you could cherry-pick that patch as well. It will depend on these being merged so it makes it simpler to include.

@hijae

hijae commented Aug 27, 2026

Copy link
Copy Markdown
Author

Thanks for tracking this down and for the fix! I found the original source for this — it's already in hhd-dev/patchwork (89eb9630d9, authored by fewtarius, co-developed by linh1987, carried by Antheas) — so I ported that version instead of yours: it's simpler (a static pin table, no runtime DMI check needed) and keeps clean original authorship. Pushed as a third commit on this PR, same pin/value you verified (0x1a → 0x90170110).

I don't have an AIR 1S myself, so if you get a chance to confirm this exact commit works on your hardware, that'd be great before it merges.

@pastaq

pastaq commented Aug 27, 2026

Copy link
Copy Markdown
Member

IIRC the mini pro and the air 1s have inverted pin configurations or something similar that necessitated the DMI match but I'm not certain what it exactly was. Hopefully we can find a mini pro user to test as well

@bl1nk

bl1nk commented Aug 27, 2026

Copy link
Copy Markdown

Thank you both, again.

I built both modules and loaded them against the current -testing kernel and everything worked just fine (after restarting steam, so it could pick up the new pipewire sink, I think).

If anyone wants to try it out on their device(s) to see if it breaks on something that is not the AYANEO Air 1S

Clone the kernel repo:

git clone https://github.com/OpenGamingCollective/linux.git
cd linux

git fetch origin pull/102/head:pr-102
git switch pr-102

Set some variables:

KDIR=/lib/modules/$(uname -r)/build
REALTEK="$PWD/sound/hda/codecs/realtek"
AW87="$PWD/sound/soc/codecs/aw87xxx"

Then build the patched modules.

Realtek codec modules:

make -C "$KDIR" \
    M="$REALTEK" \
    modules

AW87xxx amplifier driver:

make -C "$KDIR" \
    M="$AW87" \
    CONFIG_SND_SOC_AW87XXX=m \
    modules

The relevant resulting modules are:

sound/hda/codecs/realtek/snd-hda-codec-realtek-lib.ko
sound/hda/codecs/realtek/snd-hda-codec-alc269.ko
sound/soc/codecs/aw87xxx/snd-soc-aw87xxx.ko

Optional check:

strings "$REALTEK/snd-hda-codec-alc269.ko" | grep -i ayaneo

should return something like:

ayaneo-speaker-pin-fix
ALC269VB_FIXUP_AYANEO_SPKR_PIN_FIX

to verify that the compiled module contains the fix.

Temporarily disable PipeWire/WirePlumber:

systemctl --user mask --runtime \
    pipewire.service pipewire.socket \
    pipewire-pulse.service pipewire-pulse.socket \
    wireplumber.service

systemctl --user stop \
    pipewire.service pipewire.socket \
    pipewire-pulse.service pipewire-pulse.socket \
    wireplumber.service

Check that nothing still has the ALSA devices open:

sudo fuser -v /dev/snd/*

(it should return nothing)

Unload the existing HDA modules:

sudo modprobe -r snd_hda_intel
sudo modprobe -r snd_hda_codec_alc269
sudo modprobe -r snd_hda_codec_realtek_lib

Load the patched modules:

sudo modprobe snd_hda_scodec_component
sudo modprobe snd_hda_codec_generic

sudo insmod "$REALTEK/snd-hda-codec-realtek-lib.ko"
sudo insmod "$REALTEK/snd-hda-codec-alc269.ko"
sudo insmod "$AW87/snd-soc-aw87xxx.ko"

sudo modprobe snd_hda_intel

You should be able to play a sound now:

speaker-test -D hw:1,0 -c 2 -r 48000 -t sine

Reboot to reset the device to its previous state.

@pastaq pastaq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pulling in unrelated changes. Please rebase and don't merge in a separate feature branch.

While rebasing, ensure each patch is tagged [NOT-FOR-UPSTREAM] in the commit title and the cherry pick sha is included by running cherry-pick -sex for each sha

ruineka and others added 10 commits September 1, 2026 22:47
…ntation Contribution by CVMagic (https://github.com/CVMagic)

aw87xxx: Use strscpy instead of strlcpy

awinic: i2c_driver cleanup and fixes

This is deliberately an OGC-carried patch and must not be sent upstream.

(cherry picked from commit 91a51cacadb95ba80227663a75fd113552b18e45)
Signed-off-by: Hijae Song <hijae@naver.com>
…gging purposes, but also fixed Reset Pin GPIO initialization issue with Ayn Loki Mini

This is deliberately an OGC-carried patch and must not be sent upstream.

(cherry picked from commit 4b4179efc86828f8762f0819aabf4413a3ba0d27)
Signed-off-by: Hijae Song <hijae@naver.com>
…a second I2C chip if specified in ACPI

This is deliberately an OGC-carried patch and must not be sent upstream.

(cherry picked from commit ed123302c7dde72a935052370de4a9b2ff3e1feb)
Signed-off-by: Hijae Song <hijae@naver.com>
…sume.

This is deliberately an OGC-carried patch and must not be sent upstream.

(cherry picked from commit 92392036d95ffdf9fc2b4b42c3dd31a8939d4027)
Signed-off-by: Hijae Song <hijae@naver.com>
This is deliberately an OGC-carried patch and must not be sent upstream.

(cherry picked from commit dac32102659fa0ae4f2692ed81810ceb834ed584)
Signed-off-by: Hijae Song <hijae@naver.com>
Multiple AyaNeo/Ayn/Orange Pi devices ship the aw87xxx amplifier with
different firmware blobs. Select the firmware filename by DMI board/
product match so each device's blob coexists under /lib/firmware
without collision, falling back to the original single filename when
no match is found.

This is deliberately an OGC-carried patch and must not be sent upstream.

Co-developed-by: bouhaa <boukehaarsma23@gmail.com>
Co-developed-by: Antheas Kapenekakis <git@antheas.dev>
Signed-off-by: Hijae Song <hijae@naver.com>
linux/of_gpio.h has been removed from the tree. None of these
files actually use anything from it (no of_gpio_* calls), so drop
the dead include to fix the build.

This is deliberately an OGC-carried patch and must not be sent upstream.

Signed-off-by: Hijae Song <hijae@naver.com>
…mponent

Newer kernels (6.16+) changed snd_soc_unregister_component()'s
signature. Add a version-gated wrapper so the driver still builds
across the kernel versions this branch needs to support.

This is deliberately an OGC-carried patch and must not be sent upstream.

Signed-off-by: Hijae Song <hijae@naver.com>
The valid-GPIO branch fell through without ever requesting the
reset pin, leaving it unclaimed. Request it with devm_gpio_request_one()
so the driver actually owns and can drive the reset line.

This is deliberately an OGC-carried patch and must not be sent upstream.

Signed-off-by: Hijae Song <hijae@naver.com>
The ALC269VB codec's internal speaker pin isn't configured
correctly on the AyaNeo AIR 1S out of the box, so no audio
plays even once the aw87xxx amplifier driver (added earlier in
this branch) is working. Add a pin fixup matching the AIR 1S's
PCI SSID that sets pin 0x1a to 0x90170110, restoring internal
speaker output.

This is deliberately an OGC-carried patch and must not be sent upstream.

Co-developed-by: linh1987
(cherry picked from commit 89eb9630d9114c38f35edc4041daf8b1d25886d3)
Signed-off-by: Hijae Song <hijae@naver.com>
@hijae
hijae force-pushed the add-aw87xxx-flip-speaker branch from d1c55aa to a289bc0 Compare September 1, 2026 14:08
@hijae

hijae commented Sep 1, 2026

Copy link
Copy Markdown
Author

@pastaq Rebased onto current features/ayaneo and reconstructed the history as 10 individual commits, each tagged [NOT-FOR-UPSTREAM].

The aw87xxx driver traces back to ChimeraOS/linux, not hhd-dev/patchwork as I'd previously said — cherry-picked (-x) the 5 real upstream commits from there, preserving original authorship. Two OGC-specific additions on top (DMI-based firmware selection, a kernel-version compat shim) are separate commits, not cherry-picks. The AIR 1S pin fixup stays cherry-picked (-x) from hhd-dev/patchwork.

Diffed the rebuilt tree against the old squash to confirm it's functionally identical, and rebuilt both modules out-of-tree to confirm they still compile.

@KyleGospo
KyleGospo merged commit 9477ffd into OpenGamingCollective:features/ayaneo Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants